import request from '@/utils/request'

// 创建设备保养周期
export function createMaintenanceCycle(data) {
  return request({
    url: '/devices/maintenance-cycle/create',
    method: 'post',
    data: data
  })
}

// 更新设备保养周期
export function updateMaintenanceCycle(data) {
  return request({
    url: '/devices/maintenance-cycle/update',
    method: 'put',
    data: data
  })
}

// 删除设备保养周期
export function deleteMaintenanceCycle(id) {
  return request({
    url: '/devices/maintenance-cycle/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除设备保养周期 */
export function deleteMaintenanceCycleList(ids) {
  return request({
    url: `/devices/maintenance-cycle/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得设备保养周期
export function getMaintenanceCycle(id) {
  return request({
    url: '/devices/maintenance-cycle/get?id=' + id,
    method: 'get'
  })
}

// 获得设备保养周期分页
export function getMaintenanceCyclePage(params) {
  return request({
    url: '/devices/maintenance-cycle/page',
    method: 'get',
    params
  })
}
// 导出设备保养周期 Excel
export function exportMaintenanceCycleExcel(params) {
  return request({
    url: '/devices/maintenance-cycle/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}